<?php

namespace App\Service\Auth\v1_3_4;

use App\Model\SocialAccount;
use App\Service\Auth\AuthBaseService;

/**
 * 第三方账号绑定信息
 */
class SocialBindInfoService extends AuthBaseService
{
    public function handle()
    {
        $userId = $this->getUserId();
        $where = [
            'user_id' => $userId,
        ];
        $list = SocialAccount::where($where)->pluck('provider')->toArray();
        $ret['list'] = [
            ['type' => 'qq', 'status' => in_array('qq', $list) ? 1 : 0],
            ['type' => 'weixin', 'status' => in_array('weixin', $list) ? 1 : 0],
        ];
        return $ret;
    }
}
